package com.ruoyi.fn.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fn.mapper.FinAccountMapper;
import com.ruoyi.fn.domain.FinAccount;
import com.ruoyi.fn.service.IFinAccountService;
import com.ruoyi.common.core.text.Convert;

/**
 * 账户Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-26
 */
@Service
public class FinAccountServiceImpl implements IFinAccountService 
{
    @Autowired
    private FinAccountMapper finAccountMapper;

    /**
     * 查询账户
     * 
     * @param accountId 账户主键
     * @return 账户
     */
    @Override
    public FinAccount selectFinAccountByAccountId(Long accountId)
    {
        return finAccountMapper.selectFinAccountByAccountId(accountId);
    }

    /**
     * 查询账户列表
     * 
     * @param finAccount 账户
     * @return 账户
     */
    @Override
    public List<FinAccount> selectFinAccountList(FinAccount finAccount)
    {
        return finAccountMapper.selectFinAccountList(finAccount);
    }

    /**
     * 新增账户
     * 
     * @param finAccount 账户
     * @return 结果
     */
    @Override
    public int insertFinAccount(FinAccount finAccount)
    {
        finAccount.setCreateTime(DateUtils.getNowDate());
        return finAccountMapper.insertFinAccount(finAccount);
    }

    /**
     * 修改账户
     * 
     * @param finAccount 账户
     * @return 结果
     */
    @Override
    public int updateFinAccount(FinAccount finAccount)
    {
        finAccount.setUpdateTime(DateUtils.getNowDate());
        return finAccountMapper.updateFinAccount(finAccount);
    }

    /**
     * 批量删除账户
     * 
     * @param accountIds 需要删除的账户主键
     * @return 结果
     */
    @Override
    public int deleteFinAccountByAccountIds(String accountIds)
    {
        return finAccountMapper.deleteFinAccountByAccountIds(Convert.toStrArray(accountIds));
    }

    /**
     * 删除账户信息
     * 
     * @param accountId 账户主键
     * @return 结果
     */
    @Override
    public int deleteFinAccountByAccountId(Long accountId)
    {
        return finAccountMapper.deleteFinAccountByAccountId(accountId);
    }
}
